package com.epam.facebook_client.processor;

import android.content.Intent;
import android.os.Bundle;

import common.processor.IProcessor;

public class MethodFactory {
	private static MethodFactory instance = null;

	public static synchronized MethodFactory getInstance() {
		if (instance == null) {
			instance = new MethodFactory();
		}
		return instance;
	}

	public Bundle execute(String method, IProcessor processor, Intent intent) throws Exception {
		Bundle bundle = null;
		if (method.equals(IProcessor.METHOD_GET)) {
			bundle = processor.executeGet(intent);
		} else if (method.equals(IProcessor.METHOD_DELETE)) {
			bundle = processor.executeDelete(intent);
		} else if (method.equals(IProcessor.METHOD_POST)) {
			bundle = processor.executePost(intent);
		}
		return bundle;
	}
}
